import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

public class News implements Serializable{
	private static final long serialVersionUID = 1L;
	
	private String author;
	private String title;
	private String text;
	private Date creationDate;

	public News(String author, String title, String text) {
		this.author = author;
		this.text = text;
		this.title = title;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String toString(){
		StringBuilder sb = new StringBuilder();
		sb.append("Autore: ");
		sb.append(author);
		sb.append("\n");
		sb.append("Titolo: ");
		sb.append(title);
		sb.append("\n\n");
		sb.append(text);
		sb.append("\n\n");
		
		SimpleDateFormat ft = 
			      new SimpleDateFormat ("dd/MM/yyyy HH:mm");
		sb.append(ft.format(creationDate));
		
		return sb.toString();
	}
}
